﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NCT.MRS.DataAccessLayer.Entities;

namespace NCT.MRS.DataAccessLayer.Configurations
{
    class TestTypeSectionConfiguration : EntityTypeConfiguration<TestTypeSection>
    {
        public TestTypeSectionConfiguration()
        {
            HasKey(P => P.Id);

            Property(P => P.Name).IsRequired().HasMaxLength(30);
            Property(P => P.Code).IsRequired().HasMaxLength(30);

            HasMany(P => P.TestTypes).WithRequired(P => P.Section).HasForeignKey(P => P.SectionId);

            HasRequired(P => P.ModifiedByUser).WithMany().HasForeignKey(P => P.ModifiedByUserId).WillCascadeOnDelete(false);
        }
    }
}
